#tag Class
Protected Class NSWindowNotificationObserver
Inherits CocoaDelegate
	#tag Event
		Function DelegateClassName() As String
		  
		  return "MLNSWindowNotificationObserver"
		  
		End Function
	#tag EndEvent

	#tag Event
		Function DelegateMethods() As Tuple()
		  
		  dim methodList() as Tuple
		  methodList.Append kNotificationSelector : FPtr(AddressOf DispatchNotification) : "v@:@"
		  
		  return methodList
		  
		End Function
	#tag EndEvent


	#tag Method, Flags = &h1000
		Sub Constructor(aWindow as NSWindow = nil, handler as NSWindowNotificationInterface = nil)
		  
		  // construct a delegate and accept an optional delegate handler which is a NSWindowNotificationInterface instance
		  // this permits to use this class in two modes:
		  //
		  // 1. Without subclassing, just instantiating it passing a NSWindowNotificationInterface member that will handle
		  //     the events (eg. a window or another class). The handler can also be changed at any time setting the DelegateHandler
		  //     property.
		  //
		  // 2. Subclassing this class and handling the events. This can be also done dragging an instance of this class in a window.
		  //
		  
		  // store the window reference (it can be nil, meaning all windows)
		  windowRef = aWindow
		  
		  // store the handler
		  DelegateHandler = handler
		  
		  // call super to construct the object
		  super.Constructor
		  
		  // raise the Open event (for use by subclasses or instances dragged to a window)
		  raiseEvent Open()
		  
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub Destructor()
		  
		  // if we are registered as observer, we must unregister before getting deallocated or a runtime error will happen
		  if registered then
		    self.Unregister
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Shared Sub DispatchNotification(id as Ptr, sel as Ptr, notification as Ptr)
		  
		  // dispatch the message to the right instance handler
		  
		  #pragma StackOverflowChecking false
		  
		  #pragma unused sel
		  
		  if CocoaDelegateMap.HasKey(id) then // lookup the delegate instance
		    dim w as WeakRef = CocoaDelegateMap.Lookup(id, new WeakRef(nil))
		    dim obj as NSWindowNotificationObserver = NSWindowNotificationObserver(w.Value) // get the delegate instance
		    
		    // be sure to have a valid object
		    if obj = nil then
		      return
		    end if
		    
		    // build objects to pass to the instance method
		    dim notificationObj as NSNotification
		    if notification <> nil then
		      notificationObj = new NSNotification(notification)
		      
		      dim theWindow as NSWindow
		      if notificationObj.AssociatedObject <> nil then
		        theWindow = new NSWindow(notificationObj.AssociatedObject.id)
		      end if
		      
		      // identify the notification and call the right handler
		      select case notificationObj.Name
		        
		      case "NSWindowDidBecomeKeyNotification"
		        obj.NSWindow_DidBecomeKeyHandler notificationObj, theWindow
		        
		      case "NSWindowDidBecomeMainNotification"
		        obj.NSWindow_DidBecomeMainHandler notificationObj, theWindow
		        
		      case "NSWindowDidChangeScreenNotification"
		        obj.NSWindow_DidChangeScreenHandler notificationObj, theWindow
		        
		      case "NSWindowDidChangeScreenProfileNotification"
		        obj.NSWindow_DidChangeScreenProfileHandler notificationObj, theWindow
		        
		      case "NSWindowDidDeminiaturizeNotification"
		        obj.NSWindow_DidDeminiaturizeHandler notificationObj, theWindow
		        
		      case "NSWindowDidEndSheetNotification"
		        obj.NSWindow_DidEndSheetHandler notificationObj, theWindow
		        
		      case "NSWindowDidEndLiveResizeNotification"
		        obj.NSWindow_DidEndLiveResizeHandler notificationObj, theWindow
		        
		      case "NSWindowDidExposeNotification"
		        dim v as new NSValue(notificationObj.userInfo.Value("NSExposedRect"))
		        obj.NSWindow_DidExposeHandler notificationObj, theWindow, v.NSRectValue
		        
		      case "NSWindowDidMiniaturizeNotification"
		        obj.NSWindow_DidMiniaturizeHandler notificationObj, theWindow
		        
		      case "NSWindowDidMoveNotification"
		        obj.NSWindow_DidMoveHandler notificationObj, theWindow
		        
		      case "NSWindowDidResignKeyNotification"
		        obj.NSWindow_DidResignKeyHandler notificationObj, theWindow
		        
		      case "NSWindowDidResignMainNotification"
		        obj.NSWindow_DidResignMainHandler notificationObj, theWindow
		        
		      case "NSWindowDidResizeNotification"
		        obj.NSWindow_DidResizeHandler notificationObj, theWindow
		        
		        'case "NSWindowDidUpdateNotification"
		        'obj.NSWindow_DidUpdateHandler notificationObj, theWindow
		        
		      case "NSWindowWillBeginSheetNotification"
		        obj.NSWindow_WillBeginSheetHandler notificationObj, theWindow
		        
		      case "NSWindowWillCloseNotification"
		        obj.NSWindow_WillCloseHandler notificationObj, theWindow
		        
		      case "NSWindowWillMiniaturizeNotification"
		        obj.NSWindow_WillMiniaturizeHandler notificationObj, theWindow
		        
		      case "NSWindowWillMoveNotification"
		        obj.NSWindow_WillMoveHandler notificationObj, theWindow
		        
		      case "NSWindowWillStartLiveResizeNotification"
		        obj.NSWindow_WillStartLiveResizeHandler notificationObj, theWindow
		        
		      case "NSWindowWillEnterFullScreenNotification"
		        obj.NSWindow_WillEnterFullScreenHandler notificationObj, theWindow
		        
		      case "NSWindowDidEnterFullScreenNotification"
		        obj.NSWindow_DidEnterFullScreenHandler notificationObj, theWindow
		        
		      case "NSWindowWillExitFullScreenNotification"
		        obj.NSWindow_WillExitFullScreenHandler notificationObj, theWindow
		        
		      case "NSWindowDidExitFullScreenNotification"
		        obj.NSWindow_DidExitFullScreenHandler notificationObj, theWindow
		        
		      case "NSWindowWillEnterVersionBrowserNotification"
		        obj.NSWindow_WillEnterVersionBrowserHandler notificationObj, theWindow
		        
		      case "NSWindowDidEnterVersionBrowserNotification"
		        obj.NSWindow_DidEnterVersionBrowserHandler notificationObj, theWindow
		        
		      case "NSWindowWillExitVersionBrowserNotification"
		        obj.NSWindow_WillExitVersionBrowserHandler notificationObj, theWindow
		        
		      case "NSWindowDidExitVersionBrowserNotification"
		        obj.NSWindow_DidExitVersionBrowserHandler notificationObj, theWindow
		        
		      end select
		      
		    end if
		    
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidBecomeKeyHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidBecomeKey(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidBecomeKey(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidBecomeMainHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidBecomeMain(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidBecomeMain(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidChangeScreenHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidChangeScreen(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidChangeScreen(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidChangeScreenProfileHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidChangeScreenProfile(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidChangeScreenProfile(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidDeminiaturizeHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidDeminiaturize(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidDeminiaturize(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidEndLiveResizeHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidEndLiveResize(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidEndLiveResize(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidEndSheetHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidEndSheet(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidEndSheet(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidEnterFullScreenHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidEnterFullScreen(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidEnterFullScreen(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidEnterVersionBrowserHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidEnterVersionBrowser(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidEnterVersionBrowser(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidExitFullScreenHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidExitFullScreen(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidExitFullScreen(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidExitVersionBrowserHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidExitVersionBrowser(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidExitVersionBrowser(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidExposeHandler(notification as NSNotification, aWindow as NSWindow, exposedRect as Cocoa.NSRect)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidExpose(notification, aWindow, exposedRect)
		  else
		    raiseEvent NSWindow_DidExpose(notification, aWindow, exposedRect)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidMiniaturizeHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidMiniaturize(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidMiniaturize(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidMoveHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidMove(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidMove(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidResignKeyHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidResignKey(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidResignKey(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidResignMainHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidResignMain(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidResignMain(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_DidResizeHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_DidResize(notification, aWindow)
		  else
		    raiseEvent NSWindow_DidResize(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_WillBeginSheetHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_WillBeginSheet(notification, aWindow)
		  else
		    raiseEvent NSWindow_WillBeginSheet(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_WillCloseHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_WillClose(notification, aWindow)
		  else
		    raiseEvent NSWindow_WillClose(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_WillEnterFullScreenHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_WillEnterFullScreen(notification, aWindow)
		  else
		    raiseEvent NSWindow_WillEnterFullScreen(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_WillEnterVersionBrowserHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_WillEnterVersionBrowser(notification, aWindow)
		  else
		    raiseEvent NSWindow_WillEnterVersionBrowser(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_WillExitFullScreenHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_WillExitFullScreen(notification, aWindow)
		  else
		    raiseEvent NSWindow_WillExitFullScreen(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_WillExitVersionBrowserHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_WillExitVersionBrowser(notification, aWindow)
		  else
		    raiseEvent NSWindow_WillExitVersionBrowser(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_WillMiniaturizeHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_WillMiniaturize(notification, aWindow)
		  else
		    raiseEvent NSWindow_WillMiniaturize(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_WillMoveHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_WillMove(notification, aWindow)
		  else
		    raiseEvent NSWindow_WillMove(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Sub NSWindow_WillStartLiveResizeHandler(notification as NSNotification, aWindow as NSWindow)
		  
		  // handle the message and call the handler or fire the event
		  
		  if DelegateHandler <> nil then
		    DelegateHandler.NSWindow_WillStartLiveResize(notification, aWindow)
		  else
		    raiseEvent NSWindow_WillStartLiveResize(notification, aWindow)
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub Register()
		  
		  // These notifications are accessible through the shared default notification center
		  
		  // only proceed if we are not already registered
		  if not registered then
		    // get the notification center
		    dim center as NSNotificationCenter = NSNotificationCenter.DefaultCenter
		    
		    // registering for all notifications will include
		    // NSWindowDidUpdateNotification
		    // which cause a stack overflow for repeatly getting notified about windows updates
		    
		    'center.AddObserver self, kNotificationSelector, "", windowRef
		    
		    // So we need to individually subscribe all notifications but the one above
		    center.AddObserver self, kNotificationSelector, "NSWindowDidBecomeKeyNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidBecomeMainNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidChangeScreenNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidChangeScreenProfileNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidDeminiaturizeNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidEndSheetNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidEndLiveResizeNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidExposeNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidMiniaturizeNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidMoveNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidResignKeyNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidResignMainNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidResizeNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowWillBeginSheetNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowWillCloseNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowWillMiniaturizeNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowWillMoveNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowWillStartLiveResizeNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowWillEnterFullScreenNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidEnterFullScreenNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowWillExitFullScreenNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidExitFullScreenNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowWillEnterVersionBrowserNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidEnterVersionBrowserNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowWillExitVersionBrowserNotification", windowRef
		    center.AddObserver self, kNotificationSelector, "NSWindowDidExitVersionBrowserNotification", windowRef
		    
		    // mark we registered as observer
		    registered = true
		  end if
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub Unregister()
		  
		  // These notifications are accessible through the shared default notification center
		  
		  // only proceed if we are currently registered
		  if registered then
		    // get the notification center
		    dim center as NSNotificationCenter = NSNotificationCenter.DefaultCenter
		    
		    // unregister self as observer
		    center.RemoveObserver self
		    
		    // mark we are no longer registered as observer
		    registered = false
		  end if
		End Sub
	#tag EndMethod


	#tag Hook, Flags = &h0
		Event NSWindow_DidBecomeKey(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidBecomeMain(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidChangeScreen(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidChangeScreenProfile(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidDeminiaturize(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidEndLiveResize(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidEndSheet(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidEnterFullScreen(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidEnterVersionBrowser(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidExitFullScreen(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidExitVersionBrowser(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidExpose(notification as NSNotification, aWindow as NSWindow, exposedRect as Cocoa.NSRect)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidMiniaturize(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidMove(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidResignKey(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidResignMain(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_DidResize(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_WillBeginSheet(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_WillClose(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_WillEnterFullScreen(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_WillEnterVersionBrowser(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_WillExitFullScreen(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_WillExitVersionBrowser(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_WillMiniaturize(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_WillMove(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event NSWindow_WillStartLiveResize(notification as NSNotification, aWindow as NSWindow)
	#tag EndHook

	#tag Hook, Flags = &h0
		Event Open()
	#tag EndHook


	#tag Property, Flags = &h0
		DelegateHandler As NSWindowNotificationInterface
	#tag EndProperty

	#tag Property, Flags = &h21
		Private registered As Boolean
	#tag EndProperty

	#tag Property, Flags = &h21
		Private windowRef As NSWindow
	#tag EndProperty


	#tag Constant, Name = kNotificationSelector, Type = String, Dynamic = False, Default = \"dispatchWindowNotification:", Scope = Private
	#tag EndConstant


	#tag ViewBehavior
		#tag ViewProperty
			Name="ClassName"
			Group="Behavior"
			Type="String"
			EditorType="MultiLineEditor"
			InheritedFrom="CocoaDelegate"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Description"
			Group="Behavior"
			Type="String"
			EditorType="MultiLineEditor"
			InheritedFrom="NSObject"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InitialValue="-2147483648"
			Type="Integer"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
	#tag EndViewBehavior
End Class
#tag EndClass
